package com.huanshi.utils;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;

public class TimeUtil {

    public static LocalDateTime generateCurrentTime(){
//        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        return LocalDateTime.parse(format.format(new Date()));
        return LocalDateTime.now();
    }

    public static String recentYear(){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.YEAR, -1);
        return format.format(calendar.getTime());
    }
}
